# -*- coding: utf-8 -*-
# @File: backend => test.py
# @CreateTime: 2025/8/25 16:09
# @Author: EvanZhang
# @Info: pydantic模型测试
from pydantic import BaseModel, Field
from typing import List, Optional
from datetime import datetime

class UserTestRequest(BaseModel):
    id:int = Field()
    username:str = Field(..., description="用户名")
    password_hash:str = Field(..., description="密码/哈希值")
    avatar_url:str = Field(..., description="头像URL")
    chips:int = Field(..., description="筹码数量")
    created_at:datetime = Field(default_factory=datetime.now, description="创建时间")
    # created_at: Optional[datetime] = None

class UserTestResponse(BaseModel):
    id:int = Field()
    username:str = Field(..., description="用户名")
    avatar_url:str = Field(..., description="头像URL")
    chips:int = Field(..., description="筹码数量")
    created_at:datetime = Field(..., description="创建时间")

class UserListTestResponse(BaseModel):
    total:int = Field(default=0, description="用户总数")
    users:List[UserTestResponse] = Field(default_factory=list, description="用户列表")